#!/bin/bash

file=$1
filename=$(basename $file .tgz)
dir=$2

cd $dir
mkdir $filename
mv $file $filename/.
cd $filename
tar xvzf $file
rm $file